#include<bits/stdc++.h>
using namespace std;
bool cmp(string a, string b) {
	if (a > b) {
		if (a.length() > b.length()) {
			if (a.substr(0, b.length()) == b) {
				return a[b.length()] > b[0];
			}
		}
		return true;
	}
	else {
		if (b.length() > a.length()) {
			if (b.substr(0, a.length()) == a) {
				return b[a.length()] < a[0];
			}
		}
		return false;
	}
    return false;
}
int main(){
	freopen("max.in" , "r" , stdin);
	freopen("max.out" , "w" , stdout);
	int n;
	cin >> n;
	string a[20] , maxs = "" , s = "" , f;
	for(int i = 0 ; i < n ; i++){
		cin >> a[i];
	}
	sort(a, a + n, cmp);
	for (int i=0; i<n; i++) {
		cout << a[i];
	}
	return 0;
}